<template>
  <h1>轮播图添加</h1>
  <el-form :model="form" label-width="120px">
    <el-form-item label="图片地址">
      <el-input v-model="form.img" />
    </el-form-item>
    <el-form-item label="图片提示">
      <el-input v-model="form.alt" />
    </el-form-item>
    <el-form-item label="图片链接">
      <el-input v-model="form.link" />
    </el-form-item>
    <el-form-item   >
      <el-button :plain="true" @click="onSubmit">添加</el-button>
      
    </el-form-item>
  </el-form>
</template>

<script setup lang="ts">


import { reactive } from 'vue'
import service from '../../../utils/service';
import { ElMessage } from 'element-plus'
const form = reactive({
  img: '',
  alt: '',
  link: '',

})
const onSubmit = () => {
  service({
    url: '/banner/add',
    method: "post",
    data:form
    
  }).then(res => {
    if (res.data.code === "200") {
      ElMessage({
        message: '添加成功.',
        type: 'success',
      })
     
    }
  })
}




</script>

<style scoped>
.el-input{
  width: 600px; 
}
</style>